<%--
  Created by IntelliJ IDEA.
  User: tum0r
  Date: 2019-03-13
  Time: 14:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="util.Decode" %>
<%@ page import="net.sf.json.JSONObject" %>
<%@ page import="net.sf.json.JSONArray" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="server.*" %>
<%@ page import="java.util.LinkedHashMap" %>
<%@ page import="java.util.LinkedList" %>
<%@ page import="config.ApplicationConfig" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    LinkedHashMap<String, String> pageConfig = ApplicationConfig.readConfig("page.json");
    request.setCharacterEncoding(pageConfig.get("encode"));
    response.setCharacterEncoding(pageConfig.get("encode"));
    Object user = session.getAttribute("user");
    boolean mutable = true;
%>
<html>
<head>
    <title>信 息</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/page.css">
    <link rel="stylesheet" href="css/manager.css">
    <script src="js/echarts.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse head" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                    data-target="#navbar">
                <span class="sr-only">切换导航</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <%
                SettingServer settingServer = new SettingServer();
                settingServer.open();
                JSONObject logo = settingServer.readSettingObject("logo");
                if (logo.getString("logo").equals("")) {
            %>
            <img class="navbar-brand" src="image/logo.png">
            <%
            } else {
                FileServer fileServer = new FileServer();
                fileServer.open();
            %>
            <img class="navbar-brand" src="<%=fileServer.getImage(logo.getString("logo"))%>">
            <%
                    fileServer.close();
                }
            %>
            <a class="navbar-brand" href="#"><%=logo.getString("name")%>
            </a>
        </div>
        <div class="collapse navbar-collapse" id="navbar">
            <ul class="nav navbar-nav">
                <li>
                    <a href="index.jsp">首 页</a>
                </li>
                <li>
                    <a href="game.jsp">比 赛</a>
                </li>
                <li>
                    <a href="rank.jsp">排 名</a>
                </li>
                <li>
                    <a href="about.jsp">通 知</a>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right text-center">
                <%
                    LoginServer loginServer = new LoginServer();
                    loginServer.open();
                    Object cookie = session.getAttribute("cookie");
                    if (user == null || user.toString().equals("") || cookie == null || cookie.toString().equals("") || loginServer.checkLogin(user.toString(), cookie.toString())) {
                        session.removeAttribute("user");
                        session.removeAttribute("cookie");
                        session.setAttribute("infoTitle", "未登录");
                        session.setAttribute("infoContent", "您还未登录，请先登录");
                        session.setAttribute("return", "index.jsp");
                        session.setAttribute("panelColor", "red");
                        loginServer.close();
                        response.sendRedirect("information.jsp");
                        return;
                    } else {
                        int user_type = loginServer.getUserType(user.toString());
                        if (user_type == 0) {
                            loginServer.close();
                            response.sendRedirect("mine");
                            return;
                        }
                        loginServer.updateLoginTime(user.toString());
                        loginServer.close();
                %>
                <li>
                    <a href="mine" class="glyphicon glyphicon-user active">&nbsp;<%=user%>
                    </a>
                </li>
                <li>
                    <a href="#" class="glyphicon glyphicon-log-out" data-toggle="modal"
                       data-target="#logout">&nbsp;退出</a>
                    <div class="modal fade" id="logout" role="dialog" aria-hidden="true"
                         aria-labelledby="logoutLabel">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                                            onclick="input_clear(document.getElementById('logout_form'))">&times;
                                    </button>
                                    <h4 class="modal-title" id="logoutLabel">退 出 登 录</h4>
                                </div>
                                <div class="modal-body">
                                    确定要退出吗？
                                    <form id="logout_form" action="logout" method="post">
                                        <input type="text" name="username" hidden="hidden" value="<%=user%>">
                                    </form>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-primary"
                                            onclick="form_submit(document.getElementById('logout_form'))">&nbsp;退出
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </li>
                <%
                    }
                %>
            </ul>
        </div>
    </div>
</nav>

<div class="container main">
    <div class="row">
        <div class="col-xs-12 col-sm-12">
            <div class="panel-body text-center">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h2 class="panel-title collapse_mouse" data-toggle="collapse" data-target="#mine"
                            id="section-my-information">个人信息</h2>
                    </div>
                    <div id="mine" class="panel-collapse collapse in">
                        <div class="panel-body">
                            <%
                                UserServer userServer = new UserServer();
                                userServer.open();
                                JSONObject result = userServer.searchUserByName(user.toString());
                                if (result.size() != 0 && JSONObject.fromObject(result.getString("icon")).size() != 0) {
                                    JSONObject icon = JSONObject.fromObject(result.getString("icon"));
                                    FileServer fileServer = new FileServer();
                                    fileServer.open();
                                    String uuid = icon.getString("uuid");
                                    String name = icon.getString("name");
                            %>
                            <img src="<%=fileServer.getImage(uuid)%>" class="img-circle icon_mouse" alt="<%=name%>"
                                 width=170px height=170px data-toggle="modal" data-target="#changeIcon"
                                 style="border: darkorange 10px solid">
                            <%
                                fileServer.close();
                            } else {
                            %>
                            <img src="image/default_icon.png" class="img-circle icon_mouse" alt="default" width=170
                                 height=170 data-toggle="modal" data-target="#changeIcon"
                                 style="border: darkorange 10px solid">
                            <%
                                }
                            %>
                            <div class="modal fade" id="changeIcon" role="dialog" aria-hidden="true"
                                 aria-labelledby="changeIconLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true"
                                                    onclick="input_clear(document.getElementById('change_icon_form'))">
                                                &times;
                                            </button>
                                            <h4 class="modal-title" id="changeIconLabel">修 改 头 像</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <br>
                                            <br>
                                            <form id="change_icon_form" method="post" enctype="multipart/form-data"
                                                  action="change_icon" class="text-center">
                                                <input type="file" name="icon_file" accept="image/jpeg,image/png">
                                                <br>
                                                <br>
                                                <font color="red">请选择头像图片，只支持jpg（jpeg）和png图像</font>
                                            </form>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    onclick="form_clear(document.getElementById('change_icon_form'))">
                                                重 填
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('change_icon_form'))">
                                                修 改
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <hr class="split_line">
                            <br>
                            <br>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td><b>用户名</b></td>
                                    <td><b>真实姓名</b></td>
                                    <td><b>性别</b></td>
                                    <td><b>衣服尺码</b></td>
                                    <td><b>电话</b></td>
                                    <td><b>邮箱</b></td>
                                    <td><b>用户类型</b></td>
                                    <td><b>管理</b></td>
                                </tr>
                                <%
                                    if (result.size() != 0) {
                                %>
                                <tr>
                                    <td><%=result.getString("username")%>
                                    </td>
                                    <td><%=result.getString("real_name")%>
                                    </td>
                                    <td><%=result.getString("sex")%>
                                    </td>
                                    <td><%=result.getString("clothes_size")%>
                                    </td>
                                    <td><%=result.getString("phone")%>
                                    </td>
                                    <td><%=result.getString("email")%>
                                    </td>
                                    <td>

                                        <%
                                            String type = result.getString("type");
                                            if (type.equals("0")) {
                                        %>
                                        <span class="btn btn-warning">参赛者</span>
                                        <%
                                        } else if (type.equals("1")) {
                                        %>
                                        <span class="btn btn-success">管理员</span>
                                        <%
                                        } else {
                                        %>
                                        <span class="btn btn-danger">未知</span>
                                        <%
                                            }
                                            JSONObject teamJSON = settingServer.readSettingObject("team");
                                            mutable = teamJSON.getBoolean("mutable");
                                        %>
                                    </td>
                                    <td>
                                        <button class="btn btn-info" data-toggle="modal" data-target="#changeMine">
                                            修改信息
                                        </button>
                                        <div class="modal fade" id="changeMine" role="dialog" aria-hidden="true"
                                             aria-labelledby="changeMineLabel">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true"
                                                                onclick="input_clear(document.getElementById('change_mine_form'))">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title" id="changeMineLabel">修 改 信 息</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="change_mine_form" action="change_information"
                                                              method="post">
                                                            <input type="text" name="oldUsername" hidden="hidden"
                                                                   value="<%=user%>">
                                                            <br>
                                                            <br>
                                                            用&nbsp;&nbsp;户&nbsp;&nbsp;名:&nbsp;&nbsp;<input type="text"
                                                            <%
                                                            if(!mutable){
                                                            %>
                                                                                                           readonly="readonly"
                                                            <%
                                                            }
                                                            %>
                                                                                                           name="changeUser"
                                                                                                           class="text-center"
                                                                                                           value="<%=user%>">
                                                            <br>
                                                            <br>
                                                            真实姓名:&nbsp;&nbsp;<input type="text" name="realName"
                                                                                    value="<%=result.getString("real_name")%>"
                                                                                    class="text-center">
                                                            <br>
                                                            <br>
                                                            性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:&nbsp;&nbsp;
                                                            <select class="text-center select_size" name="sex">
                                                                <%
                                                                    if (result.getString("sex").equals("女")) {
                                                                %>
                                                                <option value="男">男</option>
                                                                <option value="女" selected="selected">女</option>
                                                                <%
                                                                } else {
                                                                %>
                                                                <option value="男" selected="selected">男</option>
                                                                <option value="女">女</option>
                                                                <%
                                                                    }
                                                                %>
                                                            </select>
                                                            <br>
                                                            <br>
                                                            衣服尺码:&nbsp;&nbsp;
                                                            <select class="text-center select_size" name="clothes_size">
                                                                <%
                                                                    String clothesSize = result.getString("clothes_size").toUpperCase();
                                                                    if (clothesSize.equals("L")) {
                                                                %>
                                                                <option value="S">S</option>
                                                                <option value="M">M</option>
                                                                <option value="L" selected="selected">L</option>
                                                                <option value="XL">XL</option>
                                                                <option value="XXL">XXL</option>
                                                                <option value="XXXL">XXXL</option>
                                                                <%
                                                                } else if (clothesSize.equals("XL")) {
                                                                %>
                                                                <option value="S">S</option>
                                                                <option value="M">M</option>
                                                                <option value="L">L</option>
                                                                <option value="XL" selected="selected">XL</option>
                                                                <option value="XXL">XXL</option>
                                                                <option value="XXXL">XXXL</option>
                                                                <%
                                                                } else if (clothesSize.equals("S")) {
                                                                %>
                                                                <option value="S" selected="selected">S</option>
                                                                <option value="M">M</option>
                                                                <option value="L">L</option>
                                                                <option value="XL">XL</option>
                                                                <option value="XXL">XXL</option>
                                                                <option value="XXXL">XXXL</option>
                                                                <%
                                                                } else if (clothesSize.equals("XXL")) {
                                                                %>
                                                                <option value="S">S</option>
                                                                <option value="M">M</option>
                                                                <option value="L">L</option>
                                                                <option value="XL">XL</option>
                                                                <option value="XXL" selected="selected">XXL</option>
                                                                <option value="XXXL">XXXL</option>
                                                                <%
                                                                } else if (clothesSize.equals("XXXL")) {
                                                                %>
                                                                <option value="S">S</option>
                                                                <option value="M">M</option>
                                                                <option value="L">L</option>
                                                                <option value="XL">XL</option>
                                                                <option value="XXL">XXL</option>
                                                                <option value="XXXL" selected="selected">XXXL</option>
                                                                <%
                                                                } else {
                                                                %>
                                                                <option value="S" selected="selected">S</option>
                                                                <option value="M">M</option>
                                                                <option value="L">L</option>
                                                                <option value="XL">XL</option>
                                                                <option value="XXL">XXL</option>
                                                                <option value="XXXL">XXXL</option>
                                                                <%
                                                                    }
                                                                %>
                                                            </select>
                                                            <br>
                                                            <br>
                                                            电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话:&nbsp;&nbsp;<input
                                                                type="text" name="phone"
                                                                value="<%=result.getString("phone")%>"
                                                                class="text-center">
                                                            <br>
                                                            <br>
                                                            邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱:&nbsp;&nbsp;<input
                                                                type="text" name="email"
                                                                value="<%=result.getString("email")%>"
                                                                class="text-center">
                                                            <br>
                                                            <br>
                                                        </form>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                onclick="form_clear(document.getElementById('change_mine_form'))">
                                                            重 填
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('change_mine_form'))">
                                                            修 改
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <button class="btn btn-info" data-toggle="modal"
                                                data-target="#changeMinePassword">修改密码
                                        </button>
                                        <div class="modal fade" id="changeMinePassword" role="dialog" aria-hidden="true"
                                             aria-labelledby="changeMinePasswordLabel">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true"
                                                                onclick="input_clear(document.getElementById('change_mine_password_form'))">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title" id="changeMinePasswordLabel">修 改 密
                                                            码</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="change_mine_password_form" action="change_password"
                                                              method="post">
                                                            <input type="text" name="changeUser" hidden="hidden"
                                                                   value="<%=user%>">
                                                            <br>
                                                            <br>
                                                            旧&nbsp;&nbsp;密&nbsp;&nbsp;码:&nbsp;&nbsp;<input
                                                                type="password"
                                                                name="oldPassword" class="text-center">
                                                            <br>
                                                            <br>
                                                            密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;&nbsp;<input
                                                                type="password"
                                                                name="password" class="text-center">
                                                            <br>
                                                            <br>
                                                            再次输入:&nbsp;&nbsp;<input type="password"
                                                                                    name="again"
                                                                                    class="text-center">
                                                            <br>
                                                            <br>
                                                        </form>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                onclick="form_clear(document.getElementById('change_mine_password_form'))">
                                                            重 填
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('change_mine_password_form'))">
                                                            修 改
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <%
                                } else {
                                %>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <%
                                    }
                                %>
                            </table>
                            <br>
                            <br>
                            <hr class="split_line">
                            <br>
                            <br>
                            <h3 class="text-center">提交记录</h3>
                            <br>
                            <br>
                            <%
                                JSONArray resultArray = userServer.getUserRecordResultAnalysis(user.toString());
                                result = resultArray.getJSONObject(0);
                            %>
                            <div id="myResult" class="my_result"></div>
                            <script>
                                var myResult = echarts.init(document.getElementById('myResult'));
                                myResult.setOption({
                                    title: {
                                        left: 'center',
                                        right: 'center'
                                    },
                                    series: [
                                        {
                                            name: '提交记录',
                                            type: 'pie',
                                            radius: ['25%', '50%'],
                                            data: [
                                                <%
                                                Iterator iterator = result.keys();
                                                String key;
                                                if(result.size()==0){
                                                    %>
                                                {
                                                    value: 0,
                                                    name: '\n\n无提交记录'
                                                }
                                                <%
                                                    }
                                                long count = 0;
                                                long sum = Long.parseLong(result.getString("sum"));
                                                    while(iterator.hasNext()){
                                                        key = iterator.next().toString();
                                                        if(!key.equals("sum")){
                                                        count = Long.parseLong(result.getString(key));
                                                    %>
                                                {
                                                    value:<%=count%>,
                                                    name: '\n\n\n\n<%=key%>\n\n<%=count%> 次 / <%=sum%> 次\n\n占比 <%=((int)(((double)count/sum)*10000))/100.0%>%\n\n\n\n'
                                                },
                                                <%
                                                }
                                                    }
                                                %>
                                            ]
                                        }
                                    ]
                                });
                            </script>
                            <br>
                            <br>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td><b>提交序号</b></td>
                                    <td><b>题目</b></td>
                                    <td><b>使用语言</b></td>
                                    <td><b>结果</b></td>
                                    <td><b>时间</b></td>
                                    <td><b>内存</b></td>
                                    <td><b>提交时间</b></td>
                                    <td><b>查看详情</b></td>
                                </tr>
                                <%
                                    LinkedList<LinkedHashMap<String, Object>> temp = userServer.getUserRecordResult(user.toString());
                                    Iterator<LinkedHashMap<String, Object>> userRecordResultIterator = temp.iterator();
                                    LinkedHashMap<String, Object> items;
                                    SubjectServer subjectServer = new SubjectServer();
                                    subjectServer.open();
                                    count = temp.size();
                                    while (userRecordResultIterator.hasNext()) {
                                        items = userRecordResultIterator.next();
                                %>
                                <tr>
                                    <td><%=count%>
                                    </td>
                                    <td>
                                        <%=subjectServer.getSubjectInformationByID(items.get("subject_id").toString()).containsKey("title") ? subjectServer.getSubjectInformationByID(items.get("subject_id").toString()).getString("title") : "特殊记录"%>
                                    </td>
                                    <td><%=items.get("language").toString().replace("CPP", "C++")%>
                                    </td>
                                    <td>
                                        <%
                                            String submitResult = items.get("result").toString();
                                            if (submitResult.equals("Accepted")) {
                                        %>
                                        <span class="btn btn-success"><%=submitResult%></span>
                                        <%
                                        } else if (submitResult.equals("Compilation Error") || submitResult.equals("Time Limit Exceeded") || submitResult.equals("Memory Limit Exceeded") || submitResult.equals("Presentation Error")) {
                                        %>
                                        <span class="btn btn-warning"><%=submitResult%></span>
                                        <%
                                        } else if (submitResult.equals("Compile...") || submitResult.equals("Running...")) {
                                        %>
                                        <span class="btn btn-info"><%=submitResult%></span>
                                        <%
                                        } else if (submitResult.equals("RunTime Error")) {
                                        %>
                                        <span class="btn btn-primary"><%=submitResult%></span>
                                        <%
                                        } else {
                                        %>
                                        <span class="btn btn-danger"><%=submitResult%></span>
                                        <%
                                            }
                                        %>
                                    </td>
                                    <td><%=items.get("time")%> ms
                                    </td>
                                    <td><%=items.get("memory")%> kb
                                    </td>
                                    <td><%=items.get("submit_time")%>
                                    </td>
                                    <td>
                                        <form id="code_<%=items.get("uuid")%>" method="post" action="code.jsp"
                                              target="_blank">
                                            <input type="text" name="recordID" value="<%=items.get("uuid")%>"
                                                   hidden="hidden">
                                        </form>
                                        <button class="btn btn-info"
                                                onclick="form_submit(document.getElementById('code_<%=items.get("uuid")%>'))">
                                            查看代码
                                        </button>
                                    </td>
                                </tr>
                                <%
                                        count--;
                                    }
                                    subjectServer.close();
                                %>
                            </table>
                            <br>
                            <br>
                            <%
                                userServer.close();
                            %>
                        </div>
                    </div>
                </div>
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h2 class="panel-title collapse_mouse" data-toggle="collapse" data-target="#page"
                            id="section-page-setting">页面设置</h2>
                    </div>
                    <div id="page" class="panel-collapse collapse">
                        <div class="panel-body text-center">
                            <%
                                String logoImage = logo.getString("logo");
                                String name = logo.getString("name");
                                FileServer fileServer = new FileServer();
                                fileServer.open();
                            %>
                            <br>
                            <h2>网站管理</h2>
                            <br>
                            <%
                                if (logoImage.equals("")) {
                            %>
                            <img src="image/logo.png" class="img-circle icon_mouse" width=210px height=210px
                                 data-toggle="modal"
                                 data-target="#changeLogo" style="border: darkorange 10px solid">
                            <%
                            } else {
                            %>
                            <img src="<%=fileServer.getImage(logoImage)%>" class="img-circle icon_mouse" width=210px
                                 height=210px
                                 data-toggle="modal" data-target="#changeLogo" style="border: darkorange 10px solid">
                            <%
                                }
                            %>
                            <div class="modal fade" id="changeLogo" role="dialog" aria-hidden="true"
                                 aria-labelledby="changeLogoLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true"
                                                    onclick="input_clear(document.getElementById('change_logo_form'))">
                                                &times;
                                            </button>
                                            <h4 class="modal-title" id="changeLogoLabel">修 改 网 站 图 标</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <br>
                                            <br>
                                            <form id="change_logo_form" method="post" enctype="multipart/form-data"
                                                  action="change_web_logo" class="text-center">
                                                <input type="file" name="icon_file" accept="image/jpeg,image/png">
                                                <br>
                                                <br>
                                                <font color="red">请选择网站图标，只支持jpg（jpeg）和png图像</font>
                                            </form>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    onclick="form_clear(document.getElementById('change_logo_form'))">
                                                重 填
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('change_logo_form'))">
                                                修 改
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <form method="post" class="col-sm-4 col-sm-offset-4" action="change_web_name">
                                <table class="table table-striped word_break">
                                    <tr>
                                        <td class="text-center"><b>网站名称</b></td>
                                        <td class="text-center"><b>管理</b></td>
                                    </tr>
                                    <tr>
                                        <td class="text-center">
                                            <input type="text" name="name" class="form-control text-center"
                                                   value="<%=name%>">
                                        </td>
                                        <td class="text-center">
                                            <button type="submit" class="btn btn-info">修改</button>
                                        </td>
                                    </tr>
                                </table>
                            </form>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <hr class="split_line">
                            <br>
                            <br>
                            <%
                                resultArray = settingServer.readSettingArray("carousel");
                            %>
                            <h2>首页轮播图管理</h2>
                            <table class="table table-striped text-center">
                                <tr>
                                    <td><b>图片</b></td>
                                    <td><b>管理</b></td>
                                </tr>
                                <%
                                    for (int i = 0; i < resultArray.size(); i++) {
                                        result = resultArray.getJSONObject(i);
                                %>
                                <tr>
                                    <td><img src="<%=fileServer.getImage(result.getString("uuid"))%>"
                                             class="index_carousel_img"></td>
                                    <td>
                                        <form id="<%=result.getString("uuid")%>" method="post" action="delete_carousel">
                                            <input type="text" name="carousel" value="<%=result.getString("uuid")%>"
                                                   hidden="hidden">
                                        </form>
                                        <button class="btn btn-danger" data-toggle="modal"
                                                data-target="#deleteCarousel<%=result.getString("uuid")%>">删除
                                        </button>
                                        <div class="modal fade" id="deleteCarousel<%=result.getString("uuid")%>"
                                             role="dialog" aria-hidden="true"
                                             aria-labelledby="deleteCarouselLabel<%=result.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true"
                                                                onclick="input_clear(document.getElementById('change_icon_form'))">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="deleteCarouselLabel<%=result.getString("uuid")%>">删 除 轮
                                                            播 图</h4>
                                                    </div>
                                                    <div class="modal-body text-center">
                                                        <img src="<%=fileServer.getImage(result.getString("uuid"))%>"
                                                             class="index_carousel_img">
                                                        <br>
                                                        <br>
                                                        <font color="red">确定删除此轮播图吗？</font>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('<%=result.getString("uuid")%>'))">
                                                            删 除
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <%
                                    }
                                %>
                                <tr>
                                    <td colspan="2">
                                        <button class="btn btn-primary" data-toggle="modal" data-target="#addCarousel">
                                            添加
                                        </button>
                                        <div class="modal fade" id="addCarousel" role="dialog" aria-hidden="true"
                                             aria-labelledby="addCarouselLabel">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true"
                                                                onclick="input_clear(document.getElementById('change_carousel_form'))">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title" id="addCarouselLabel">上 传 轮 播 图</h4>
                                                    </div>
                                                    <div class="modal-body text-center">
                                                        <br>
                                                        <br>
                                                        <form id="change_carousel_form" method="post"
                                                              enctype="multipart/form-data"
                                                              action="add_carousel" class="text-center">
                                                            <input type="file" name="carousel_file"
                                                                   accept="image/jpeg,image/png" multiple="multiple">
                                                            <br>
                                                            <br>
                                                            <font color="red">请选择首页轮播图图片，只支持jpg（jpeg）和png图像，可多选</font>
                                                        </form>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-warning"
                                                                onclick="form_clear(document.getElementById('change_carousel_form'))">
                                                            重 新 选 择
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('change_carousel_form'))">
                                                            上 传
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <br>
                            <br>
                            <hr class="split_line">
                            <br>
                            <br>
                            <%
                                resultArray = settingServer.readSettingArray("foot");
                            %>
                            <h2>页脚管理</h2>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td class="col-xs-1 col-sm-1 col-md-1 col-lg-1"><b>位置</b></td>
                                    <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><b>标题</b></td>
                                    <td class="col-xs-3 col-sm-3 col-md-3 col-lg-3"><b>第一行</b></td>
                                    <td class="col-xs-3 col-sm-3 col-md-3 col-lg-3"><b>第二行</b></td>
                                    <td class="col-xs-3 col-sm-3 col-md-3 col-lg-3"><b>第三行</b></td>
                                </tr>
                                <form method="post" action="foot" id="foot_form">
                                    <%
                                        String local;
                                        for (int i = 0; i < resultArray.size(); i++) {
                                            result = resultArray.getJSONObject(i);
                                            local = result.getString("name");
                                            if (local.equals("foot0")) {
                                                local = "左";
                                            } else if (local.equals("foot1")) {
                                                local = "中";
                                            } else if (local.equals("foot2")) {
                                                local = "右";
                                            }
                                    %>
                                    <tr>
                                        <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><%=local%>
                                        </td>
                                        <td><input name="<%=result.getString("name")+"Title"%>"
                                                   value="<%=result.getString("title")%>"
                                                   class="col-xs-12 col-sm-12 col-md-12 col-lg-12"></td>
                                        <td><input name="<%=result.getString("name")+"Line0"%>"
                                                   value="<%=result.getString("line0")%>"
                                                   class="col-xs-12 col-sm-12 col-md-12 col-lg-12"></td>
                                        <td><input name="<%=result.getString("name")+"Line1"%>"
                                                   value="<%=result.getString("line1")%>"
                                                   class="col-xs-12 col-sm-12 col-md-12 col-lg-12"></td>
                                        <td><input name="<%=result.getString("name")+"Line2"%>"
                                                   value="<%=result.getString("line2")%>"
                                                   class="col-xs-12 col-sm-12 col-md-12 col-lg-12"></td>
                                    </tr>
                                    <%
                                        }
                                    %>
                                </form>
                                <tr>
                                    <td colspan="5">
                                        <button class="btn btn-primary"
                                                onclick="form_submit(document.getElementById('foot_form'))">设置
                                        </button>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h2 class="panel-title collapse_mouse" data-toggle="collapse" data-target="#game"
                            id="section-game-setting">比赛设置</h2>
                    </div>
                    <div id="game" class="panel-collapse collapse">
                        <div class="panel-body text-center">
                            <%
                                GameServer gameServer = new GameServer();
                                gameServer.open();
                                JSONObject game = gameServer.getGameInformation();
                                String gameLogo = game.getString("logo");
                            %>
                            <br>
                            <h3 class="text-center">比赛信息管理</h3>
                            <br>
                            <br>
                            <%
                                if (gameLogo.equals("")) {
                            %>
                            <img src="image/game_logo.png" class="img-circle icon_mouse" width=210px height=210px
                                 data-toggle="modal"
                                 data-target="#changeGameLogo" style="border: darkorange 10px solid">
                            <%
                            } else {
                            %>
                            <img src="<%=fileServer.getImage(gameLogo)%>" class="img-circle icon_mouse" width=210px
                                 height=210px
                                 data-toggle="modal" data-target="#changeGameLogo"
                                 style="border: darkorange 10px solid">
                            <%
                                }
                                fileServer.close();
                            %>
                            <div class="modal fade" id="changeGameLogo" role="dialog" aria-hidden="true"
                                 aria-labelledby="changeGameLogoLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true"
                                                    onclick="input_clear(document.getElementById('change_game_logo_form'))">
                                                &times;
                                            </button>
                                            <h4 class="modal-title" id="changeGameLogoLabel">修 改 比 赛 图 标</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <br>
                                            <br>
                                            <form id="change_game_logo_form" method="post" enctype="multipart/form-data"
                                                  action="change_game_logo" class="text-center">
                                                <input type="file" name="icon_file" accept="image/jpeg,image/png">
                                                <br>
                                                <br>
                                                <font color="red">请选择比赛图标，只支持jpg（jpeg）和png图像</font>
                                            </form>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    onclick="form_clear(document.getElementById('change_game_logo_form'))">
                                                重 填
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('change_game_logo_form'))">
                                                修 改
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <br>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td><b>比赛名</b></td>
                                    <td><b>主办方</b></td>
                                    <td><b>开始时间</b></td>
                                    <td><b>结束时间</b></td>
                                    <td><b>结束提醒时间</b></td>
                                    <td><b>加罚时</b></td>
                                    <td><b>参赛人数</b></td>
                                    <td><b>管理</b></td>
                                </tr>
                                <tr>
                                    <td><%=game.getString("name")%>
                                    </td>
                                    <td><%=game.getString("sponsor")%>
                                    </td>
                                    <td><%=game.getString("start")%>
                                    </td>
                                    <td><%=game.getString("stop")%>
                                    </td>
                                    <td><%=game.getString("time_is_up")%>
                                    </td>
                                    <td><%=game.getString("punish")%>
                                    </td>
                                    <td><%=game.getString("playerCount")%>
                                    </td>
                                    <td>
                                        <button class="btn btn-info" data-toggle="modal"
                                                data-target="#changeGameInformation">修改
                                        </button>
                                    </td>
                                    <div class="modal fade" id="changeGameInformation"
                                         role="dialog" aria-hidden="true"
                                         aria-labelledby="changeGameInformationLabel">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                            aria-hidden="true">
                                                        &times;
                                                    </button>
                                                    <h4 class="modal-title"
                                                        id="changeGameInformationLabel">修 改 比 赛 信 息</h4>
                                                </div>
                                                <div class="modal-body text-center">
                                                    <form id="change_game_information_form" method="post"
                                                          action="change_game_information">
                                                        比赛名称:&nbsp;&nbsp;&nbsp;&nbsp;<input name="name"
                                                                                            value="<%=game.getString("name")%>"
                                                                                            class="text-center">
                                                        <br>
                                                        <br>
                                                        主办单位:&nbsp;&nbsp;&nbsp;&nbsp;<input name="sponsor"
                                                                                            value="<%=game.getString("sponsor")%>"
                                                                                            class="text-center">
                                                        <br>
                                                        <br>
                                                        开始时间:&nbsp;&nbsp;&nbsp;&nbsp;<input name="start" type="text"
                                                                                            value="<%=game.getString("start")%>"
                                                                                            class="text-center">
                                                        <br>
                                                        <br>
                                                        结束时间:&nbsp;&nbsp;&nbsp;&nbsp;<input name="stop" type="text"
                                                                                            value="<%=game.getString("stop")%>"
                                                                                            class="text-center">
                                                        <br>
                                                        <br>
                                                        提醒时间:&nbsp;&nbsp;&nbsp;&nbsp;<input name="time_is_up"
                                                                                            type="text"
                                                                                            value="<%=game.getString("time_is_up")%>"
                                                                                            class="text-center">
                                                        <br>
                                                        <br>
                                                        加罚时间:&nbsp;&nbsp;&nbsp;&nbsp;<input name="punish" type="text"
                                                                                            value="<%=game.getString("punish")%>"
                                                                                            class="text-center">
                                                    </form>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-danger"
                                                            data-dismiss="modal">
                                                        取 消
                                                    </button>
                                                    <button type="button" class="btn btn-primary"
                                                            onclick="form_submit(document.getElementById('change_game_information_form'))">
                                                        修 改
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </tr>
                            </table>
                            <br>
                            <br>
                            <hr class="split_line">
                            <br>
                            <br>
                            <h3 class="text-center">题目管理</h3>
                            <button class="btn btn-danger" data-toggle="modal"
                                    data-target="#clearSubject">清&nbsp;&nbsp;空
                            </button>
                            <div class="modal fade" id="clearSubject"
                                 role="dialog" aria-hidden="true"
                                 aria-labelledby="clearSubjectLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">
                                                &times;
                                            </button>
                                            <h4 class="modal-title"
                                                id="clearSubjectLabel">清&nbsp;空&nbsp;赛&nbsp;题</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <form id="clear_subject_form"
                                                  method="post" action="clear_subject">
                                                <input name="active" value="clear"
                                                       hidden="hidden">
                                            </form>
                                            <br>
                                            <br>
                                            <font color="red">确定要清空赛题吗</font>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    data-dismiss="modal">
                                                取&nbsp;消
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('clear_subject_form'))">
                                                清&nbsp;空
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td><b>序号</b></td>
                                    <td><b>题目</b></td>
                                    <td><b>C/C++运行时间</b></td>
                                    <td><b>C/C++运行内存</b></td>
                                    <td><b>Java运行时间</b></td>
                                    <td><b>Java运行内存</b></td>
                                    <td><b>Python运行时间</b></td>
                                    <td><b>Python运行内存</b></td>
                                    <td><b>管理</b></td>
                                </tr>
                                <%
                                    subjectServer = new SubjectServer();
                                    subjectServer.open();
                                    JSONArray subjects = subjectServer.getAllSubjectInformation();
                                    JSONObject item;

                                    for (int index = 0; index < subjects.size(); index++) {
                                        item = subjects.getJSONObject(index);
                                        JSONArray answerLimit = JSONArray.fromObject(item.getString("answer_limit"));
                                        JSONObject javaLimit = JSONArray.fromObject(item.getString("answer_limit")).getJSONObject(0);
                                        JSONObject cppLimit = JSONArray.fromObject(item.getString("answer_limit")).getJSONObject(0);
                                        JSONObject pythonLimit = JSONArray.fromObject(item.getString("answer_limit")).getJSONObject(0);
                                        JSONObject tempLimit;
                                        for (int i = 0; i < answerLimit.size(); i++) {
                                            tempLimit = answerLimit.getJSONObject(i);
                                            if (tempLimit.getString("language").equals("Java")) {
                                                javaLimit = tempLimit;
                                            } else if (tempLimit.getString("language").equals("C/CPP")) {
                                                cppLimit = tempLimit;
                                            } else {
                                                pythonLimit = tempLimit;
                                            }
                                        }
                                %>
                                <tr>
                                    <td><%=index%>
                                    </td>
                                    <td><%=item.getString("title")%>
                                    </td>
                                    <td><%=cppLimit.getLong("timeLimit")%> ms
                                    </td>
                                    <td><%=cppLimit.getLong("memoryLimit")%> kb
                                    </td>
                                    <td><%=javaLimit.getLong("timeLimit")%> ms
                                    </td>
                                    <td><%=javaLimit.getLong("memoryLimit")%> kb
                                    </td>
                                    <td><%=pythonLimit.getLong("timeLimit")%> ms
                                    </td>
                                    <td><%=pythonLimit.getLong("memoryLimit")%> kb
                                    </td>
                                    <td>
                                        <button class="btn btn-info" data-toggle="modal"
                                                data-target="#changeSubject<%=item.getString("uuid")%>">修 改
                                        </button>
                                        <div class="modal fade" id="changeSubject<%=item.getString("uuid")%>"
                                             role="dialog" aria-hidden="true"
                                             aria-labelledby="changeSubjectLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="changeSubjectLabel<%=item.getString("uuid")%>">修 改 赛
                                                            题</h4>
                                                    </div>
                                                    <div class="modal-body text-center">
                                                        <form id="change_subject_form<%=item.getString("uuid")%>"
                                                              method="post" action="change_subject">
                                                            <input name="uuid" value="<%=item.getString("uuid")%>"
                                                                   hidden="hidden">
                                                            题&nbsp;&nbsp;目&nbsp;&nbsp;标&nbsp;&nbsp;题:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                                name="title"
                                                                class="text-center"
                                                                value="<%=item.getString("title")%>">
                                                            <br>
                                                            <br>
                                                            C/C++运行时间:&nbsp;&nbsp;&nbsp;&nbsp;<input name="cppTimeLimit"
                                                                                                     type="text"
                                                                                                     class="text-center"
                                                                                                     value="<%=cppLimit.getLong("timeLimit")%>">
                                                            ms
                                                            <br>
                                                            <br>
                                                            C/C++运行内存:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                                name="cppMemoryLimit"
                                                                type="text"
                                                                class="text-center"
                                                                value="<%=cppLimit.getLong("memoryLimit")%>">
                                                            kb
                                                            <br>
                                                            <br>
                                                            Java&nbsp;运&nbsp;行&nbsp;时&nbsp;间:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                                name="javaTimeLimit"
                                                                type="text"
                                                                class="text-center"
                                                                value="<%=javaLimit.getLong("timeLimit")%>">
                                                            ms
                                                            <br>
                                                            <br>
                                                            Java&nbsp;运&nbsp;行&nbsp;内&nbsp;存:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                                name="javaMemoryLimit"
                                                                type="text"
                                                                class="text-center"
                                                                value="<%=javaLimit.getLong("memoryLimit")%>">
                                                            kb
                                                            <br>
                                                            <br>
                                                            Python&nbsp;运&nbsp;行&nbsp;时&nbsp;间:&nbsp;&nbsp;<input
                                                                name="pythonTimeLimit"
                                                                type="text"
                                                                class="text-center"
                                                                value="<%=pythonLimit.getLong("timeLimit")%>">
                                                            ms
                                                            <br>
                                                            <br>
                                                            Python&nbsp;运&nbsp;行&nbsp;内&nbsp;存:&nbsp;&nbsp;<input
                                                                name="pythonMemoryLimit"
                                                                type="text"
                                                                class="text-center"
                                                                value="<%=pythonLimit.getLong("memoryLimit")%>">
                                                            kb
                                                            <br>
                                                            <br>
                                                            <row>
                                                                <div class="col-sm-6">
                                                                    <b>题目内容</b>
                                                                    <br>
                                                                    <br>
                                                                    <textarea name="content"
                                                                              class="subject_textarea"><%=item.getString("content")%></textarea>
                                                                </div>
                                                                <div class="col-sm-6">
                                                                    <b>答案格式匹配</b>
                                                                    <br>
                                                                    <br>
                                                                    <textarea name="format"
                                                                              class="subject_textarea"><%=item.getString("format")%></textarea>
                                                                </div>
                                                            </row>
                                                            <row>
                                                                <div class="col-sm-6">
                                                                    <br>
                                                                    <b>测试用例</b>
                                                                    <br>
                                                                    <br>
                                                                    <textarea name="testCase"
                                                                              class="subject_textarea"><%=item.getString("test_case")%></textarea>
                                                                    <br>
                                                                    <br>
                                                                </div>
                                                                <div class="col-sm-6">
                                                                    <br>
                                                                    <b>用例结果</b>
                                                                    <br>
                                                                    <br>
                                                                    <textarea name="testCaseResult"
                                                                              class="subject_textarea"><%=item.getString("test_case_result")%></textarea>
                                                                    <br>
                                                                    <br>
                                                                </div>
                                                            </row>
                                                        </form>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('change_subject_form<%=item.getString("uuid")%>'))">
                                                            修 改
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <button class="btn btn-danger" data-toggle="modal"
                                                data-target="#deleteSubject<%=item.getString("uuid")%>">删 除
                                        </button>
                                        <div class="modal fade" id="deleteSubject<%=item.getString("uuid")%>"
                                             role="dialog" aria-hidden="true"
                                             aria-labelledby="deleteSubjectLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="deleteSubjectLabel<%=item.getString("uuid")%>">删 除 赛
                                                            题</h4>
                                                    </div>
                                                    <div class="modal-body text-center">
                                                        <form id="delete_subject_form<%=item.getString("uuid")%>"
                                                              method="post" action="delete_subject">
                                                            <input name="uuid" value="<%=item.getString("uuid")%>"
                                                                   hidden="hidden">
                                                        </form>
                                                        <br>
                                                        <br>
                                                        <font color="red">确定要删除赛题吗</font>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('delete_subject_form<%=item.getString("uuid")%>'))">
                                                            删 除
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <button class="btn btn-warning" data-toggle="modal"
                                                data-target="#recompileSubject<%=item.getString("uuid")%>">重 置 编 译
                                        </button>
                                        <div class="modal fade" id="recompileSubject<%=item.getString("uuid")%>"
                                             role="dialog" aria-hidden="true"
                                             aria-labelledby="recompileSubjectLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="recompileSubjectLabel<%=item.getString("uuid")%>">重 置 编 译</h4>
                                                    </div>
                                                    <div class="modal-body text-center">
                                                        <form id="recompile_form<%=item.getString("uuid")%>"
                                                              method="post" action="recompile_subject">
                                                            <input name="uuid" value="<%=item.getString("uuid")%>"
                                                                   hidden="hidden">
                                                        </form>
                                                        <br>
                                                        <br>
                                                        <font color="red">确定要重置编译吗</font>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('recompile_form<%=item.getString("uuid")%>'))">
                                                            重 置
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <%
                                    }
                                    subjectServer.close();
                                %>
                                <tr>
                                    <td colspan="10">
                                        <button class="btn btn-success" data-toggle="modal" data-target="#addSubject">添
                                            加
                                        </button>
                                    </td>
                                    <div class="modal fade" id="addSubject"
                                         role="dialog" aria-hidden="true"
                                         aria-labelledby="addSubjectLabel">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                            aria-hidden="true"
                                                            onclick="form_clear(document.getElementById('add_subject_form'))">
                                                        &times;
                                                    </button>
                                                    <h4 class="modal-title"
                                                        id="addSubjectLabel">新 增 赛 题</h4>
                                                </div>
                                                <div class="modal-body text-center">
                                                    <form id="add_subject_form" method="post" action="add_subject">
                                                        题&nbsp;&nbsp;目&nbsp;&nbsp;标&nbsp;&nbsp;题:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                            name="title"
                                                            class="text-center">
                                                        <br>
                                                        <br>
                                                        C/C++运行时间:&nbsp;&nbsp;&nbsp;&nbsp;<input name="cppTimeLimit"
                                                                                                 type="text"
                                                                                                 class="text-center">
                                                        ms
                                                        <br>
                                                        <br>
                                                        C/C++运行内存:&nbsp;&nbsp;&nbsp;&nbsp;<input name="cppMemoryLimit"
                                                                                                 type="text"
                                                                                                 class="text-center">
                                                        kb
                                                        <br>
                                                        <br>
                                                        Java&nbsp;运&nbsp;行&nbsp;时&nbsp;间:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                            name="javaTimeLimit"
                                                            type="text"
                                                            class="text-center">
                                                        ms
                                                        <br>
                                                        <br>
                                                        Java&nbsp;运&nbsp;行&nbsp;内&nbsp;存:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                            name="javaMemoryLimit"
                                                            type="text"
                                                            class="text-center">
                                                        kb
                                                        <br>
                                                        <br>
                                                        Python&nbsp;运&nbsp;行&nbsp;时&nbsp;间:&nbsp;&nbsp;<input
                                                            name="pythonTimeLimit"
                                                            type="text"
                                                            class="text-center">
                                                        ms
                                                        <br>
                                                        <br>
                                                        Python&nbsp;运&nbsp;行&nbsp;内&nbsp;存:&nbsp;&nbsp;<input
                                                            name="pythonMemoryLimit"
                                                            type="text"
                                                            class="text-center">
                                                        kb
                                                        <br>
                                                        <br>
                                                        <row>
                                                            <div class="col-sm-6">
                                                                <b>题目内容</b>
                                                                <br>
                                                                <br>
                                                                <textarea name="content"
                                                                          class="subject_textarea"></textarea>
                                                            </div>
                                                            <div class="col-sm-6">
                                                                <b>答案格式匹配</b>
                                                                <br>
                                                                <br>
                                                                <textarea name="format"
                                                                          class="subject_textarea"></textarea>
                                                            </div>
                                                        </row>
                                                        <row>
                                                            <div class="col-sm-6">
                                                                <br>
                                                                <b>测试用例</b>
                                                                <br>
                                                                <br>
                                                                <textarea name="testCase"
                                                                          class="subject_textarea"></textarea>
                                                                <br>
                                                                <br>
                                                            </div>
                                                            <div class="col-sm-6">
                                                                <br>
                                                                <b>用例结果</b>
                                                                <br>
                                                                <br>
                                                                <textarea name="testCaseResult"
                                                                          class="subject_textarea"></textarea>
                                                                <br>
                                                                <br>
                                                            </div>
                                                        </row>
                                                    </form>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-danger"
                                                            data-dismiss="modal"
                                                            onclick="form_clear(document.getElementById('add_subject_form'))">
                                                        取 消
                                                    </button>
                                                    <button type="button" class="btn btn-primary"
                                                            onclick="form_submit(document.getElementById('add_subject_form'))">
                                                        增 加
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </tr>
                            </table>
                            <br>
                            <br>
                            <hr class="split_line">
                            <br>
                            <br>
                            <h3 class="text-center">通知管理</h3>
                            <br>
                            <br>
                            <table class="table table-striped word_break">
                                <tr>
                                    <td class="text-center"><b>序号</b></td>
                                    <td class="text-center"><b>标题</b></td>
                                    <td class="text-center"><b>等级</b></td>
                                    <td class="text-center"><b>时间</b></td>
                                    <td class="text-center"><b>管理</b></td>
                                </tr>
                                <%
                                    NoticeServer noticeServer = new NoticeServer();
                                    noticeServer.open();
                                    JSONArray noticeResult = noticeServer.getNotice();
                                    JSONObject noticeItem;
                                    for (int i = 0; i < noticeResult.size(); i++) {
                                        noticeItem = noticeResult.getJSONObject(i);
                                %>
                                <tr>
                                    <td class="text-center"><%=(i + 1)%>
                                    </td>
                                    <td class="text-center"><%=noticeItem.getString("title")%>
                                    </td>
                                    <td class="text-center">
                                        <%
                                            String priority = noticeItem.getString("priority");
                                            if (priority.equals("0")) {
                                        %>
                                        <span class="btn btn-success">一般</span>
                                        <%
                                        } else if (priority.equals("1")) {
                                        %>
                                        <span class="btn btn-warning">重要</span>
                                        <%
                                        } else {
                                        %>
                                        <span class="btn btn-danger">紧急</span>
                                        <%
                                            }
                                        %>
                                    </td>
                                    <td class="text-center"><%=noticeItem.getString("time")%>
                                    </td>
                                    <td class="text-center">
                                        <button class="btn btn-danger" data-toggle="modal"
                                                data-target="#deleteNotice<%=noticeItem.getString("uuid")%>">删 除
                                        </button>
                                    </td>
                                    <div class="modal fade" id="deleteNotice<%=noticeItem.getString("uuid")%>"
                                         role="dialog" aria-hidden="true"
                                         aria-labelledby="deleteNoticeLabel<%=noticeItem.getString("uuid")%>">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                            aria-hidden="true"
                                                            onclick="form_clear(document.getElementById('delete_notice_form<%=noticeItem.getString("uuid")%>'))">
                                                        &times;
                                                    </button>
                                                    <h4 class="modal-title"
                                                        id="deleteNoticeLabel<%=noticeItem.getString("uuid")%>">删 除 通
                                                        知</h4>
                                                </div>
                                                <div class="modal-body text-center">
                                                    <form id="delete_notice_form<%=noticeItem.getString("uuid")%>"
                                                          method="post" action="delete_notice">
                                                        <input type="text" name="noticeID"
                                                               value="<%=noticeItem.getString("uuid")%>"
                                                               hidden="hidden">
                                                        <br>
                                                        <br>
                                                        <font color="red">确定删除通知吗？</font>
                                                    </form>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-danger"
                                                            data-dismiss="modal"
                                                            onclick="form_clear(document.getElementById('delete_notice_form<%=noticeItem.getString("uuid")%>'))">
                                                        取 消
                                                    </button>
                                                    <button type="button" class="btn btn-primary"
                                                            onclick="form_submit(document.getElementById('delete_notice_form<%=noticeItem.getString("uuid")%>'))">
                                                        删 除
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </tr>
                                <%
                                    }
                                    noticeServer.close();
                                %>
                                <tr>
                                    <td class="text-center" colspan="5">
                                        <button class="btn btn-info" data-toggle="modal" data-target="#addNotice">新 增
                                        </button>
                                    </td>
                                </tr>
                                <div class="modal fade" id="addNotice"
                                     role="dialog" aria-hidden="true"
                                     aria-labelledby="addNoticeLabel">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"
                                                        aria-hidden="true"
                                                        onclick="form_clear(document.getElementById('add_notice_form'))">
                                                    &times;
                                                </button>
                                                <h4 class="modal-title"
                                                    id="addNoticeLabel">新 增 通 知</h4>
                                            </div>
                                            <div class="modal-body text-center">
                                                <form id="add_notice_form" method="post" action="add_notice">
                                                    <br>
                                                    <br>
                                                    标题：<input type="text" name="noticeTitle" class="text-center">
                                                    <br>
                                                    <br>
                                                    <textarea name="noticeContent"
                                                              class="subject_textarea"></textarea>
                                                    <br>
                                                    <br>
                                                    通知等级：<input type="radio" name="level" value="0" checked="checked">&nbsp;&nbsp;一般
                                                    <input type="radio" name="level" value="1">&nbsp;&nbsp;重要
                                                    <input type="radio" name="level" value="2">&nbsp;&nbsp;紧急
                                                </form>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-danger"
                                                        data-dismiss="modal"
                                                        onclick="form_clear(document.getElementById('add_notice_form'))">
                                                    取 消
                                                </button>
                                                <button type="button" class="btn btn-primary"
                                                        onclick="form_submit(document.getElementById('add_notice_form'))">
                                                    增 加
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </table>
                            <br>
                            <br>
                            <hr class="split_line">
                            <br>
                            <br>
                            <h3 class="text-center">提交记录</h3>
                            <button class="btn btn-success" onclick="window.open('dynamic_accepted.jsp')"
                                    target="_blank">Accepted记录
                            </button>
                            <button class="btn btn-danger" data-toggle="modal"
                                    data-target="#clearRecord">清&nbsp;&nbsp;空
                            </button>
                            <div class="modal fade" id="clearRecord"
                                 role="dialog" aria-hidden="true"
                                 aria-labelledby="clearRecordLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">
                                                &times;
                                            </button>
                                            <h4 class="modal-title"
                                                id="clearRecordLabel">清&nbsp;空&nbsp;提&nbsp;交&nbsp;记&nbsp;录</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <form id="clear_record_form"
                                                  method="post" action="clear_record">
                                                <br>
                                                <input type="radio" name="active" value="0" checked="checked">参赛者&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" name="active" value="1">管理员&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" name="active" value="2">全部
                                            </form>
                                            <br>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    data-dismiss="modal">
                                                取&nbsp;消
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('clear_record_form'))">
                                                清&nbsp;空
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <%
                                userServer = new UserServer();
                                userServer.open();
                                resultArray = userServer.getAllUserRecordResultAnalysis();
                                result = resultArray.getJSONObject(0);
                            %>
                            <br>
                            <br>
                            <br>
                            <div id="allUserResult" class="my_result"></div>
                            <script>
                                var myResult = echarts.init(document.getElementById('allUserResult'));
                                myResult.setOption({
                                    title: {
                                        left: 'center',
                                        right: 'center'
                                    },
                                    series: [
                                        {
                                            name: '提交记录',
                                            type: 'pie',
                                            radius: ['25%', '50%'],
                                            data: [
                                                <%
                                                iterator = result.keys();
                                                if(result.size()==0){
                                                    %>
                                                {
                                                    value: 0,
                                                    name: '\n\n无提交记录'
                                                }
                                                <%
                                                    }
                                                count = 0;
                                                sum = Long.parseLong(result.getString("sum"));
                                                    while(iterator.hasNext()){
                                                        key = iterator.next().toString();
                                                        if(!key.equals("sum")){
                                                        count = Long.parseLong(result.getString(key));
                                                    %>
                                                {
                                                    value:<%=count%>,
                                                    name: '\n\n\n\n<%=key%>\n\n<%=count%> 次 / <%=sum%> 次\n\n占比 <%=((int)(((double)count/sum)*10000))/100.0%>%\n\n\n\n'
                                                },
                                                <%
                                                }
                                                    }
                                                %>
                                            ]
                                        }
                                    ]
                                });
                            </script>
                            <br>
                            <br>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td><b>提交序号</b></td>
                                    <td><b>用户</b></td>
                                    <td><b>题目</b></td>
                                    <td><b>使用语言</b></td>
                                    <td><b>结果</b></td>
                                    <td><b>时间</b></td>
                                    <td><b>内存</b></td>
                                    <td><b>提交时间</b></td>
                                    <td><b>查看详情</b></td>
                                </tr>
                                <%
                                    temp = userServer.getAllUserRecordResult();
                                    userRecordResultIterator = temp.iterator();
                                    subjectServer = new SubjectServer();
                                    subjectServer.open();
                                    count = temp.size();
                                    while (userRecordResultIterator.hasNext()) {
                                        items = userRecordResultIterator.next();
                                %>
                                <tr>
                                    <td><%=count%>
                                    </td>
                                    <td><%=userServer.searchUserByID(items.get("user_id").toString()).getString("username")%>
                                    </td>
                                    <td>
                                        <%=subjectServer.getSubjectInformationByID(items.get("subject_id").toString()).containsKey("title") ? subjectServer.getSubjectInformationByID(items.get("subject_id").toString()).getString("title") : "特殊记录"%>
                                    </td>
                                    <td><%=items.get("language").toString().replace("CPP", "C++")%>
                                    </td>
                                    <td>
                                        <%
                                            String submitResult = items.get("result").toString();
                                            if (submitResult.equals("Accepted")) {
                                        %>
                                        <span class="btn btn-success"><%=submitResult%></span>
                                        <%
                                        } else if (submitResult.equals("Compilation Error") || submitResult.equals("Time Limit Exceeded") || submitResult.equals("Memory Limit Exceeded") || submitResult.equals("Presentation Error")) {
                                        %>
                                        <span class="btn btn-warning"><%=submitResult%></span>
                                        <%
                                        } else if (submitResult.equals("Compile...") || submitResult.equals("Running...")) {
                                        %>
                                        <span class="btn btn-info"><%=submitResult%></span>
                                        <%
                                        } else if (submitResult.equals("RunTime Error")) {
                                        %>
                                        <span class="btn btn-primary"><%=submitResult%></span>
                                        <%
                                        } else {
                                        %>
                                        <span class="btn btn-danger"><%=submitResult%></span>
                                        <%
                                            }
                                        %>
                                    </td>
                                    <td><%=items.get("time")%> ms
                                    </td>
                                    <td><%=items.get("memory")%> kb
                                    </td>
                                    <td><%=items.get("submit_time")%>
                                    </td>
                                    <td>
                                        <form id="code_<%=items.get("uuid")%>" method="post" action="code.jsp"
                                              target="_blank">
                                            <input type="text" name="recordID" value="<%=items.get("uuid")%>"
                                                   hidden="hidden">
                                        </form>
                                        <button class="btn btn-info"
                                                onclick="form_submit(document.getElementById('code_<%=items.get("uuid")%>'))">
                                            查看代码
                                        </button>
                                    </td>
                                </tr>
                                <%
                                        count--;
                                    }
                                    subjectServer.close();
                                %>
                            </table>
                            <br>
                            <br>
                        </div>
                    </div>
                </div>
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h2 class="panel-title collapse_mouse" data-toggle="collapse" data-target="#user"
                            id="section-user-setting">用户设置</h2>
                    </div>
                    <div id="user" class="panel-collapse collapse">
                        <div class="panel-body">
                            <br>
                            <br>
                            <%
                                userServer.close();
                                userServer = new UserServer();
                                userServer.open();
                                JSONArray clotheSize = userServer.getUsersClotheSize();
                                JSONObject playerClotheSize = clotheSize.getJSONObject(0);
                                JSONObject managerClotheSize = clotheSize.getJSONObject(1);
                            %>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td colspan="<%=playerClotheSize.size()+managerClotheSize.size()+2%>"
                                        class="clothes_table_title"><b>衣服尺码统计</b></td>
                                </tr>
                                <tr>
                                    <td colspan="<%=playerClotheSize.size()+1%>" class="clothes_table">参赛者</td>
                                    <td colspan="<%=managerClotheSize.size()+1%>" class="clothes_table">主办方</td>
                                </tr>
                                <tr>
                                    <td class="clothes_table">衣服尺码</td>
                                    <%
                                        Iterator<String> clothesSize = playerClotheSize.keys();
                                        while (clothesSize.hasNext()) {
                                    %>
                                    <td class="clothes_table"><%=clothesSize.next()%>
                                    </td>
                                    <%
                                        }
                                    %>
                                    <td class="clothes_table">衣服尺码</td>
                                    <%
                                        clothesSize = managerClotheSize.keys();
                                        while (clothesSize.hasNext()) {
                                    %>
                                    <td class="clothes_table"><%=clothesSize.next()%>
                                    </td>
                                    <%
                                        }
                                    %>
                                </tr>
                                <tr>
                                    <td class="clothes_table">数量（件）</td>
                                    <%
                                        clothesSize = playerClotheSize.keys();
                                        while (clothesSize.hasNext()) {
                                    %>
                                    <td class="clothes_table"><%=playerClotheSize.getInt(clothesSize.next())%>
                                    </td>
                                    <%
                                        }
                                    %>
                                    <td class="clothes_table">数量（件）</td>
                                    <%
                                        clothesSize = managerClotheSize.keys();
                                        while (clothesSize.hasNext()) {
                                    %>
                                    <td class="clothes_table"><%=managerClotheSize.getInt(clothesSize.next())%>
                                    </td>
                                    <%
                                        }
                                    %>
                                </tr>
                            </table>
                            <br>
                            <br>
                            <h3 class="text-center">用户管理</h3>
                            <div>
                                <button class="btn btn-danger" data-toggle="modal"
                                        data-target="#clearUser">清&nbsp;&nbsp;空
                                </button>
                                &nbsp;&nbsp;
                                <button class="btn btn-info" data-toggle="modal"
                                        data-target="#randomUser">生&nbsp;&nbsp;成
                                </button>
                                &nbsp;&nbsp;
                                <%
                                    if (mutable) {
                                %>
                                <button class="btn btn-success" data-toggle="modal"
                                        data-target="#mutable">可&nbsp;修&nbsp;改&nbsp;队&nbsp;名
                                </button>
                                <%
                                } else {
                                %>
                                <button class="btn btn-warning" data-toggle="modal"
                                        data-target="#mutable">不&nbsp;可&nbsp;修&nbsp;改&nbsp;队&nbsp;名
                                </button>
                                <%
                                    }
                                %>
                                &nbsp;&nbsp;
                                <%
                                    JSONObject registrableJSON = settingServer.readSettingObject("register");
                                    boolean registrable = registrableJSON.getBoolean("registrable");
                                    if (registrable) {
                                %>
                                <button class="btn btn-success" data-toggle="modal"
                                        data-target="#registrable">可&nbsp;注&nbsp;册
                                </button>
                                <%
                                } else {
                                %>
                                <button class="btn btn-warning" data-toggle="modal"
                                        data-target="#registrable">不&nbsp;可&nbsp;注&nbsp;册
                                </button>
                                <%
                                    }
                                %>
                            </div>
                            <div class="modal fade" id="clearUser"
                                 role="dialog" aria-hidden="true"
                                 aria-labelledby="clearUserLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">
                                                &times;
                                            </button>
                                            <h4 class="modal-title"
                                                id="clearUserLabel">
                                                清&nbsp;空&nbsp;用&nbsp;户</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <form id="clear_user_form"
                                                  method="post" action="clear_user">
                                                <br>
                                                <input type="radio" name="active" value="0" checked="checked">参赛者&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" name="active" value="1">管理员&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" name="active" value="2">全部
                                            </form>
                                            <br>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    data-dismiss="modal">
                                                取&nbsp;消
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('clear_user_form'))">
                                                清&nbsp;空
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <div class="modal fade" id="randomUser"
                                 role="dialog" aria-hidden="true"
                                 aria-labelledby="randomUserLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">
                                                &times;
                                            </button>
                                            <h4 class="modal-title"
                                                id="randomUserLabel">
                                                生&nbsp;成&nbsp;用&nbsp;户</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <form id="random_user_form"
                                                  method="post" action="random_user">
                                                <br>
                                                数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量:&nbsp;&nbsp;&nbsp;&nbsp;<select
                                                    name="count"
                                                    class="text-center random_select_size">
                                                <option value="1" selected="selected">1</option>
                                                <option value="2">2</option>
                                                <option value="3">3</option>
                                                <option value="4">4</option>
                                                <option value="5">5</option>
                                                <option value="6">6</option>
                                                <option value="7">7</option>
                                                <option value="8">8</option>
                                                <option value="9">9</option>
                                                <option value="10">10</option>
                                                <option value="11">11</option>
                                                <option value="12">12</option>
                                                <option value="13">13</option>
                                                <option value="14">14</option>
                                                <option value="15">15</option>
                                                <option value="16">16</option>
                                                <option value="17">17</option>
                                                <option value="18">18</option>
                                                <option value="19">19</option>
                                                <option value="20">20</option>
                                                <option value="21">21</option>
                                                <option value="22">22</option>
                                                <option value="23">23</option>
                                                <option value="24">24</option>
                                                <option value="25">25</option>
                                                <option value="26">26</option>
                                                <option value="27">27</option>
                                                <option value="28">28</option>
                                                <option value="29">29</option>
                                                <option value="30">30</option>
                                            </select>
                                                <br>
                                                <br>
                                                前&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;缀:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                    type="text" name="prefix" class="text-center">
                                                <br>
                                                <br>
                                                后&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;缀:&nbsp;&nbsp;&nbsp;&nbsp;<input
                                                    type="text" name="suffix" class="text-center">
                                                <br>
                                                <br>
                                                长&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;度:&nbsp;&nbsp;&nbsp;&nbsp;<select
                                                    name="length"
                                                    class="text-center random_select_size">
                                                <option value="1">1</option>
                                                <option value="2">2</option>
                                                <option value="3">3</option>
                                                <option value="4">4</option>
                                                <option value="5">5</option>
                                                <option value="6" selected="selected">6</option>
                                                <option value="7">7</option>
                                                <option value="8">8</option>
                                            </select>
                                                <br>
                                            </form>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    data-dismiss="modal">
                                                取&nbsp;消
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('random_user_form'))">
                                                生&nbsp;成
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <div class="modal fade" id="registrable"
                                 role="dialog" aria-hidden="true"
                                 aria-labelledby="registrableLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">
                                                &times;
                                            </button>
                                            <h4 class="modal-title"
                                                id="registrableLabel">
                                                更&nbsp;改&nbsp;注&nbsp;册&nbsp;状&nbsp;态</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <form id="change_registrable_form"
                                                  method="post" action="registrable">
                                                <input name="active" value="registrable"
                                                       hidden="hidden">
                                            </form>
                                            <br>
                                            <br>
                                            <font color="red">确定要更改注册状态吗？</font>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    data-dismiss="modal">
                                                取&nbsp;消
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('change_registrable_form'))">
                                                更&nbsp;改
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br>
                            <br>
                            <div class="modal fade" id="mutable"
                                 role="dialog" aria-hidden="true"
                                 aria-labelledby="mutableLabel">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"
                                                    aria-hidden="true">
                                                &times;
                                            </button>
                                            <h4 class="modal-title"
                                                id="mutableLabel">
                                                更&nbsp;改&nbsp;修&nbsp;改&nbsp;队&nbsp;名&nbsp;状&nbsp;态</h4>
                                        </div>
                                        <div class="modal-body text-center">
                                            <form id="change_mutable_form"
                                                  method="post" action="mutable">
                                                <input name="active" value="mutable"
                                                       hidden="hidden">
                                            </form>
                                            <br>
                                            <br>
                                            <font color="red">确定要更改修改队名状态吗？</font>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-danger"
                                                    data-dismiss="modal">
                                                取&nbsp;消
                                            </button>
                                            <button type="button" class="btn btn-primary"
                                                    onclick="form_submit(document.getElementById('change_mutable_form'))">
                                                更&nbsp;改
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <table class="table table-striped text-center word_break">
                                <tr>
                                    <td><b>序号</b></td>
                                    <td><b>用户名</b></td>
                                    <td><b>真实姓名</b></td>
                                    <td><b>性别</b></td>
                                    <td><b>衣服尺码</b></td>
                                    <td><b>电话</b></td>
                                    <td><b>邮件</b></td>
                                    <td><b>用户类型</b></td>
                                    <td><b>状态</b></td>
                                    <td><b>操作</b></td>
                                </tr>
                                <%
                                    userServer.close();
                                    userServer = new UserServer();
                                    userServer.open();
                                    JSONArray users = userServer.getUserInformation();
                                    int now = 0;
                                    for (int index = 0; index < users.size(); index++) {
                                        item = users.getJSONObject(index);
                                        if (!item.getString("username").equals(user)) {
                                            now++;
                                %>
                                <tr>
                                    <td><%=now%>
                                    </td>
                                    <td><%=item.getString("username")%>
                                    </td>
                                    <td><%=item.getString("real_name")%>
                                    </td>
                                    <td><%=item.getString("sex")%>
                                    </td>
                                    <td><%=item.getString("clothes_size")%>
                                    </td>
                                    <td><%=item.getString("phone")%>
                                    </td>
                                    <td><%=item.getString("email")%>
                                    </td>
                                    <td>
                                        <%
                                            if (item.getString("type").equals("0")) {
                                        %>
                                        <button class="btn btn-warning" data-toggle="modal"
                                                data-target="#changeUserGroup<%=item.getString("uuid")%>">参赛者
                                        </button>
                                        <%
                                        } else {
                                        %>
                                        <button class="btn btn-success" data-toggle="modal"
                                                data-target="#changeUserGroup<%=item.getString("uuid")%>">管理员
                                        </button>
                                        <%
                                            }
                                        %>
                                        <div class="modal fade" id="changeUserGroup<%=item.getString("uuid")%>"
                                             role="dialog"
                                             aria-hidden="true"
                                             aria-labelledby="changeUserGroupLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="changeUserGroupLabel<%=item.getString("uuid")%>">
                                                            <%
                                                                if (item.getString("type").equals("1")) {
                                                            %>
                                                            设为参赛者
                                                            <%
                                                            } else {
                                                            %>
                                                            设为管理员
                                                            <%
                                                                }
                                                            %>
                                                        </h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="change_user_group_<%=item.getString("uuid")%>_form"
                                                              action="change_user_group"
                                                              method="post">
                                                            <input type="text" name="changeUser" hidden="hidden"
                                                                   value="<%=item.getString("username")%>">
                                                        </form>
                                                        <br>
                                                        <br>
                                                        <font color="red">
                                                            <%
                                                                if (item.getString("type").equals("1")) {
                                                            %>
                                                            确定要将用户设为参赛者吗？
                                                            <%
                                                            } else {
                                                            %>
                                                            确定要将用户设为管理员吗？
                                                            <%
                                                                }
                                                            %>
                                                        </font>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('change_user_group_<%=item.getString("uuid")%>_form'))">
                                                            确 定
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <%
                                            if (item.getString("state").equals("1")) {
                                        %>
                                        <button class="btn btn-success" data-toggle="modal"
                                                data-target="#changeUserState<%=item.getString("uuid")%>">启用
                                        </button>
                                        <%
                                        } else {
                                        %>
                                        <button class="btn btn-danger" data-toggle="modal"
                                                data-target="#changeUserState<%=item.getString("uuid")%>">封禁
                                        </button>
                                        <%
                                            }
                                        %>
                                        <div class="modal fade" id="changeUserState<%=item.getString("uuid")%>"
                                             role="dialog" aria-hidden="true"
                                             aria-labelledby="changeUserStateLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="changeUserStateLabel<%=item.getString("uuid")%>">
                                                            <%
                                                                if (item.getString("state").equals("1")) {
                                                            %>
                                                            封 禁 用 户
                                                            <%
                                                            } else {
                                                            %>
                                                            启 用 用 户
                                                            <%
                                                                }
                                                            %>
                                                        </h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="change_<%=item.getString("uuid")%>_state_form"
                                                              action="change_user_state"
                                                              method="post">
                                                            <input type="text" name="changeUser" hidden="hidden"
                                                                   value="<%=item.getString("username")%>">
                                                            <br>
                                                            <br>
                                                            <font color="red">
                                                                <%
                                                                    if (item.getString("state").equals("1")) {
                                                                %>
                                                                确定封禁用户吗？
                                                                <%
                                                                } else {
                                                                %>
                                                                确定启用用户吗？
                                                                <%
                                                                    }
                                                                %>
                                                            </font>

                                                        </form>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('change_<%=item.getString("uuid")%>_state_form'))">
                                                            <%
                                                                if (item.getString("state").equals("1")) {
                                                            %>
                                                            封禁
                                                            <%
                                                            } else {
                                                            %>
                                                            启用
                                                            <%
                                                                }
                                                            %>
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>

                                        <button class="btn btn-info" data-toggle="modal"
                                                data-target="#changeUserPassword<%=item.getString("uuid")%>">修改密码
                                        </button>
                                        <div class="modal fade" id="changeUserPassword<%=item.getString("uuid")%>"
                                             role="dialog" aria-hidden="true"
                                             aria-labelledby="changeUserPasswordLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true"
                                                                onclick="input_clear(document.getElementById('change_mine_password_form'))">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="changeUserPasswordLabel<%=item.getString("uuid")%>">修 改
                                                            密 码</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="change_<%=item.getString("uuid")%>_password_form"
                                                              action="change_password"
                                                              method="post">
                                                            <input type="text" name="changeUser" hidden="hidden"
                                                                   value="<%=item.getString("username")%>">
                                                            <input type="password" name="oldPassword" hidden="hidden">
                                                            <br>
                                                            <br>
                                                            密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;&nbsp;<input
                                                                type="password"
                                                                name="password">
                                                            <br>
                                                            <br>
                                                            再次输入:&nbsp;&nbsp;<input type="password" name="again">
                                                            <br>
                                                            <br>
                                                        </form>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                onclick="form_clear(document.getElementById('change_<%=item.getString("uuid")%>_password_form'))">
                                                            重 填
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('change_<%=item.getString("uuid")%>_password_form'))">
                                                            修 改
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        &nbsp;&nbsp;
                                        <button class="btn btn-danger" data-toggle="modal"
                                                data-target="#deleteUser<%=item.getString("uuid")%>">删除
                                        </button>
                                        <div class="modal fade" id="deleteUser<%=item.getString("uuid")%>" role="dialog"
                                             aria-hidden="true"
                                             aria-labelledby="deleteUserLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="deleteUserLabel<%=item.getString("uuid")%>">删 除 用 户</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="delete_<%=item.getString("uuid")%>_form"
                                                              action="delete_user"
                                                              method="post">
                                                            <input type="text" name="changeUser" hidden="hidden"
                                                                   value="<%=item.getString("username")%>">
                                                        </form>
                                                        <br>
                                                        <br>
                                                        <font color="red">确定要删除用户吗？</font>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('delete_<%=item.getString("uuid")%>_form'))">
                                                            删 除
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        &nbsp;&nbsp;
                                        <button class="btn btn-warning" data-toggle="modal"
                                                data-target="#punished<%=item.getString("uuid")%>">加罚时
                                        </button>
                                        <div class="modal fade" id="punished<%=item.getString("uuid")%>" role="dialog"
                                             aria-hidden="true"
                                             aria-labelledby="punishedLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="punishedLabel<%=item.getString("uuid")%>">加 罚 时</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="punished_<%=item.getString("uuid")%>_form"
                                                              action="punished"
                                                              method="post">
                                                            <input type="text" name="punishedUser" hidden="hidden"
                                                                   value="<%=item.getString("username")%>">
                                                            <input type="text" name="punishedID" hidden="hidden"
                                                                   value="<%=item.getString("uuid")%>">
                                                            <b>加罚理由</b>
                                                            <br>
                                                            <br>
                                                            <textarea name="reason"
                                                                      class="punished_textarea"></textarea>
                                                        </form>
                                                        <br>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('punished_<%=item.getString("uuid")%>_form'))">
                                                            确 定
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        &nbsp;&nbsp;
                                        <button class="btn btn-primary" data-toggle="modal"
                                                data-target="#removePunished<%=item.getString("uuid")%>">撤销最后一次加罚时
                                        </button>
                                        <div class="modal fade" id="removePunished<%=item.getString("uuid")%>"
                                             role="dialog"
                                             aria-hidden="true"
                                             aria-labelledby="removePunishedLabel<%=item.getString("uuid")%>">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"
                                                                aria-hidden="true">
                                                            &times;
                                                        </button>
                                                        <h4 class="modal-title"
                                                            id="removePunishedLabel<%=item.getString("uuid")%>">撤 销 最 后
                                                            一 次 加 罚 时</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <form id="remove_punished_<%=item.getString("uuid")%>_form"
                                                              action="remove_punished"
                                                              method="post">
                                                            <input type="text" name="punishedUser" hidden="hidden"
                                                                   value="<%=item.getString("username")%>">
                                                            <input type="text" name="punishedID" hidden="hidden"
                                                                   value="<%=item.getString("uuid")%>">
                                                        </form>
                                                        <br>
                                                        <br>
                                                        <font color="red">确定撤销最后一次加罚时吗？</font>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-danger"
                                                                data-dismiss="modal">
                                                            取 消
                                                        </button>
                                                        <button type="button" class="btn btn-primary"
                                                                onclick="form_submit(document.getElementById('remove_punished_<%=item.getString("uuid")%>_form'))">
                                                            确 定
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <%
                                        } else {
                                            if (now > 0) {
                                                now--;
                                            }
                                        }
                                    }
                                    userServer.close();
                                %>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<%
    Decode decode = new Decode();
    JSONArray foot = settingServer.readSettingArray("foot");
    JSONObject foot0 = foot.getJSONObject(0);
    JSONObject foot1 = foot.getJSONObject(1);
    JSONObject foot2 = foot.getJSONObject(2);
%>
<div class="foot">
    <row>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <br>
            <div class="foot_item_title">
                <p><%=decode.utf8Decode(foot0.getString("title"))%>
                </p>
            </div>
            <hr class="foot_split">
            <div class="foot_item">
                <p><%=decode.utf8Decode(foot0.getString("line0"))%>
                </p>
                <p><%=decode.utf8Decode(foot0.getString("line1"))%>
                </p>
                <p><%=decode.utf8Decode(foot0.getString("line2"))%>
                </p>
            </div>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <br>
            <div class="foot_item_title">
                <p><%=decode.utf8Decode(foot1.getString("title"))%>
                </p>
            </div>
            <hr class="foot_split">
            <div class="foot_item">
                <p><%=decode.utf8Decode(foot1.getString("line0"))%>
                </p>
                <p><%=decode.utf8Decode(foot1.getString("line1"))%>
                </p>
                <p><%=decode.utf8Decode(foot1.getString("line2"))%>
                </p>
            </div>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <br>
            <div class="foot_item_title">
                <p><%=decode.utf8Decode(foot2.getString("title"))%>
                </p>
            </div>
            <hr class="foot_split">
            <div class="foot_item">
                <p><%=decode.utf8Decode(foot2.getString("line0"))%>
                </p>
                <p><%=decode.utf8Decode(foot2.getString("line1"))%>
                </p>
                <p><%=decode.utf8Decode(foot2.getString("line2"))%>
                </p>
            </div>
        </div>
    </row>
</div>
<%
    settingServer.close();
%>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/page.js"></script>
</html>
